/**
 * Created by dycong on 2017/4/21.
 */
public class Test {
    private static class SingletonHolder{
        private static final Test singleton=new Test();         //静态内部类，静态只在初始化是new一次
    }
    private Test(){
        System.out.println(222);
    };
    public static Test getInstance(){
        return SingletonHolder.singleton;
    }

    enum Singleton{
        SingletonHolder{
            @Override
            protected void method1(){

            };
        };

      protected abstract void method1();
    }

    public static void main(String[] args) {

        Test.getInstance();
        Test.getInstance();
    }
}
